﻿using In66.Net.Share.Authentication;

namespace Usr.Api
{
    public class BearerAuthenticationLocalProcessor : AbstractAuthenticationProcessor
    {
        private readonly IAccountAppService _accountAppService;

        public BearerAuthenticationLocalProcessor(IAccountAppService accountAppService) => _accountAppService = accountAppService;

        public override Task<AppInfo> GetAppInfoAsync(string appId)
        {
            throw new NotImplementedException();
        }

        public override async Task<(string ValidationVersion, int Status)> GetValidatedInfoAsync(long userId)
        {
            var validatedInfo = await _accountAppService.GetUserValidatedInfoAsync(userId);

            if (validatedInfo is null)
            {
                return (string.Empty, 0);
            }

            return (validatedInfo.ValidationVersion, validatedInfo.Status);
        }
    }
}
